$(function(){
    var DATAPICKERAPI = {
        // 默认input显示当前月,自己获取后填充
        activeMonthRange: function () {
            return {
                begin: moment().set({ 'date': 1, 'hour': 0, 'minute': 0, 'second': 0 }).format('YYYY-MM-DD HH:mm:ss'),
                end: moment().set({ 'hour': 23, 'minute': 59, 'second': 59 }).format('YYYY-MM-DD HH:mm:ss')
            }
        },
        shortcutMonth: function () {
            // 当月
            var nowDay = moment().get('date');
            var prevMonthFirstDay = moment().subtract(1, 'months').set({ 'date': 1 });
            var prevMonthDay = moment().diff(prevMonthFirstDay, 'days');
            return {
                now: '-' + nowDay + ',0',
                prev: '-' + prevMonthDay + ',-' + nowDay
            }
        }
    };
    //十分秒年月日范围，包含最大最小值
    $('.J-datepicker-range').datePicker({
        hasShortcut: true,
        min: '2018-01-01 00:00:00',
        max: '2050-01-21 23:59:59',
        isRange: true,
        shortcutOptions: [{
            name: '今天',
            day: '0,0',
            time:'00:00:00,'
        },{
            name: '昨天',
            day: '-1,-1',
            time: '00:00:00,23:59:59'
        },{
            name: '最近一周',
            day: '-7,0',
            time:'00:00:00,'
        }, {
            name: '最近一个月',
            day: '-30,0',
            time: '00:00:00,'
        }, {
            name: '最近三个月',
            day: '-90, 0',
            time: '00:00:00,'
        }],
        hide: function () {
            //console.info(this.$input.eq(0).val(), this.$input.eq(1).val())
        }
    });
});